package com.cdtu.store.common.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Pattern;
import java.util.Date;

/**
 * @author dongyuhao
 */
@Data
@TableName("tb_user")
public class UserEntity {
    private static final long serialVersionUID = 1L;

    /**
     *
     */
    @TableId
    private Long id;
    /**
     * 用户名
     */
    @Length(min = 4, max = 30, message = "用户名只能在4~30位之间")
    private String username;
    /**
     * 密码，加密存储
     */
    @JsonIgnore
    @Length(min = 4, max = 30, message = "密码只能在4~30位之间")
    private String password;
    /**
     * 注册手机号
     */
    @Pattern(regexp = "^1[35678]\\d{9}$", message = "手机号格式不正确")
    private String phone;
    /**
     * 创建时间
     */
    private Date created;
    /**
     * 密码加密的salt值
     */
    @JsonIgnore
    private String salt;
}
